// --------------------------------------------------------------------------------------------------------------------
// <copyright file="IAnalyticsClient.cs" company="">
//   
// </copyright>
// <summary>
//   The AnalyticsClientBase interface.
// </summary>
// --------------------------------------------------------------------------------------------------------------------

namespace XRay.Library
{
    using System;
    using System.Collections.Generic;
    using System.Threading;
    using System.Threading.Tasks;

    using Microsoft.WindowsAzure.Storage.Shared.Protocol;

    using XRay.Library.Contracts;

    /// <summary>
    ///     The AnalyticsClientBase interface.
    /// </summary>
    public interface IAnalyticsClient
    {
        #region Public Methods and Operators

        /// <summary>
        /// The get all metrics.
        /// </summary>
        /// <param name="start">
        /// The start.
        /// </param>
        /// <param name="end">
        /// The end.
        /// </param>
        /// <returns>
        /// The <see cref="IEnumerable"/>.
        /// </returns>
        IEnumerable<MetricTransaction> GetAllHourlyMetrics(DateTimeOffset start, DateTimeOffset end);

        /// <summary>
        /// The get all metrics async.
        /// </summary>
        /// <param name="start">
        /// The start.
        /// </param>
        /// <param name="end">
        /// The end.
        /// </param>
        /// <param name="cancellationToken">
        /// The cancellation token.
        /// </param>
        /// <returns>
        /// The <see cref="Task"/>.
        /// </returns>
        Task<IEnumerable<MetricTransaction>> GetAllHourlyMetricsAsync(
            DateTimeOffset start, 
            DateTimeOffset end, 
            CancellationToken cancellationToken);

        /// <summary>
        /// The get all metrics.
        /// </summary>
        /// <param name="start">
        /// The start.
        /// </param>
        /// <param name="end">
        /// The end.
        /// </param>
        /// <returns>
        /// The <see cref="IEnumerable"/>.
        /// </returns>
        IEnumerable<MetricTransaction> GetAllMinuteMetrics(DateTimeOffset start, DateTimeOffset end);

        /// <summary>
        /// The get all metrics async.
        /// </summary>
        /// <param name="start">
        /// The start.
        /// </param>
        /// <param name="end">
        /// The end.
        /// </param>
        /// <param name="cancellationToken">
        /// The cancellation token.
        /// </param>
        /// <returns>
        /// The <see cref="Task"/>.
        /// </returns>
        Task<IEnumerable<MetricTransaction>> GetAllMinuteMetricsAsync(
            DateTimeOffset start, 
            DateTimeOffset end, 
            CancellationToken cancellationToken);

        /// <summary>
        /// The get capacity.
        /// </summary>
        /// <param name="start">
        /// The start.
        /// </param>
        /// <param name="end">
        /// The end.
        /// </param>
        /// <returns>
        /// The <see cref="IEnumerable"/>.
        /// </returns>
        IEnumerable<BlobCapacity> GetCapacity(DateTimeOffset start, DateTimeOffset end);

        /// <summary>
        /// The get capacity async.
        /// </summary>
        /// <param name="start">
        /// The start.
        /// </param>
        /// <param name="end">
        /// The end.
        /// </param>
        /// <param name="cancellationToken">
        /// The cancellation token.
        /// </param>
        /// <returns>
        /// The <see cref="Task"/>.
        /// </returns>
        Task<IEnumerable<BlobCapacity>> GetCapacityAsync(
            DateTimeOffset start, 
            DateTimeOffset end, 
            CancellationToken cancellationToken);

        /// <summary>
        /// The get log entities.
        /// </summary>
        /// <param name="start">
        /// The start.
        /// </param>
        /// <param name="end">
        /// The end.
        /// </param>
        /// <returns>
        /// The <see cref="IEnumerable"/>.
        /// </returns>
        IEnumerable<LogEntity> GetLogEntities(DateTimeOffset start, DateTimeOffset end);

        /// <summary>
        /// The get log entities async.
        /// </summary>
        /// <param name="start">
        /// The start.
        /// </param>
        /// <param name="end">
        /// The end.
        /// </param>
        /// <param name="cancellationToken">
        /// The cancellation token.
        /// </param>
        /// <returns>
        /// The <see cref="Task"/>.
        /// </returns>
        Task<IEnumerable<LogEntity>> GetLogEntitiesAsync(
            DateTimeOffset start, 
            DateTimeOffset end, 
            CancellationToken cancellationToken);

        /// <summary>
        /// The get metrics for executed api.
        /// </summary>
        /// <param name="apiName">
        /// The api name.
        /// </param>
        /// <param name="start">
        /// The start.
        /// </param>
        /// <param name="end">
        /// The end.
        /// </param>
        /// <returns>
        /// The <see cref="IEnumerable"/>.
        /// </returns>
        IEnumerable<MetricTransaction> GetHourlyMetricsForExecutedApi(
            TransactionTypeEnum apiName, 
            DateTimeOffset start, 
            DateTimeOffset end);

        /// <summary>
        /// The get metrics for executed api async.
        /// </summary>
        /// <param name="apiName">
        /// The api name.
        /// </param>
        /// <param name="start">
        /// The start.
        /// </param>
        /// <param name="end">
        /// The end.
        /// </param>
        /// <param name="cancellationToken">
        /// The cancellation token.
        /// </param>
        /// <returns>
        /// The <see cref="Task"/>.
        /// </returns>
        Task<IEnumerable<MetricTransaction>> GetHourlyMetricsForExecutedApiAsync(
            TransactionTypeEnum apiName, 
            DateTimeOffset start, 
            DateTimeOffset end, 
            CancellationToken cancellationToken);

        /// <summary>
        /// The get metrics for executed api.
        /// </summary>
        /// <param name="apiName">
        /// The api name.
        /// </param>
        /// <param name="start">
        /// The start.
        /// </param>
        /// <param name="end">
        /// The end.
        /// </param>
        /// <returns>
        /// The <see cref="IEnumerable"/>.
        /// </returns>
        IEnumerable<MetricTransaction> GetMinuteMetricsForExecutedApi(
            TransactionTypeEnum apiName,
            DateTimeOffset start,
            DateTimeOffset end);

        /// <summary>
        /// The get metrics for executed api async.
        /// </summary>
        /// <param name="apiName">
        /// The api name.
        /// </param>
        /// <param name="start">
        /// The start.
        /// </param>
        /// <param name="end">
        /// The end.
        /// </param>
        /// <param name="cancellationToken">
        /// The cancellation token.
        /// </param>
        /// <returns>
        /// The <see cref="Task"/>.
        /// </returns>
        Task<IEnumerable<MetricTransaction>> GetMinuteMetricsForExecutedApiAsync(
            TransactionTypeEnum apiName,
            DateTimeOffset start,
            DateTimeOffset end,
            CancellationToken cancellationToken);
        #endregion

        /// <summary>
        /// The configure analytics.
        /// </summary>
        /// <param name="loggingProperties">
        /// The logging properties.
        /// </param>
        /// <param name="hourMetrics">
        /// The hour metrics.
        /// </param>
        /// <param name="minuteMetrics">
        /// The minute metrics.
        /// </param>
        /// <param name="cancellationToken">
        /// The cancellation token.
        /// </param>
        /// <returns>
        /// The <see cref="Task"/>.
        /// </returns>
        Task ConfigureAnalytics(
            LoggingProperties loggingProperties, 
            MetricsProperties hourMetrics, 
            MetricsProperties minuteMetrics, 
            CancellationToken cancellationToken);
    }
}